﻿package net.pezzato.graphics {
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.events.MouseEvent;
	import fl.controls.Button;
	import net.pezzato.graphics.Window;
	import net.pezzato.localization.Translator;
	import net.pezzato.graphics.Widget;
	public class Alert extends Window {
		public function Alert(wp:Widget, text:String) {
			super(wp, Translator.translate("alert"),0 ,0 , 200, 150);
			var tf:TextField = new TextField();
			tf.width = 190;
			tf.x = 5;
			tf.height = 110;
			tf.y = 5;
			tf.defaultTextFormat = defaultTf;
			tf.text = text;
			tf.multiline = true;
			tf.autoSize = "left";
			toTop(tf);
			addChild(tf);
			var btnOk:Button = new Button();
			btnOk.label = Translator.translate("ok");
			btnOk.width = 40;
			btnOk.addEventListener(MouseEvent.CLICK, onBtnOkClick);
			centerX(btnOk);
			toBottom(btnOk);
			addChild(btnOk);
			fitContent();
			centerWindow();
		}
		private function onBtnOkClick(event:MouseEvent) {
			parent.removeChild(this);
		}
	}
}